﻿@model HMoPro.Models.UploadResourceFile

@{
    ViewBag.Title = "CreateUploadFile";
}
@{
    //Layout = null;
}

<style>
    #up {
        margin-top: -5px;
    }

        #up span {
            display: inline-block;
            padding-right: 5px;
        }

            #up span .uploadify {
                top: 0;
            }

    fieldset .col-xs-1, fieldset .col-xs-11 {
        margin-bottom: 10px;
    }
</style>
<div id="main">
    <h3>编辑资源 - STEP 2</h3>
    <link href="@Url.Content("~/Scripts/uploadify-v3.1/uploadify.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/uploadify-v3.1/jquery.uploadify-3.1.min.js")" type="text/javascript"></script>
    @*@section Scripts {
            @Scripts.Render("~/bundles/jqueryval")

            @Scripts.Render("~/bundles/uploadify")
        }
        @Styles.Render("~/uploadify-v3.1/css")*@

    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)

    <fieldset class="row" style="padding-top:20px;">
        <div class="col-xs-1">
            @Html.LabelFor(model => model.Uploadimage)
            @*@Html.ValidationMessageFor(model => model.Uploadimage)*@
        </div>
        <div class="col-xs-11" id="up">
            @*                @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })*@
            <script type="text/javascript">
                var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
                var ASPSESSID = "@Session.SessionID";

                $(function () {
                    $('#image1').uploadify({
                        'auto': false,
                        'formData': { 'resourceid': '@ViewData["resourceid"]', 'state': 1, 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
                        'buttonText': '请选择图片',
                        'swf': '@Url.Content("~/Scripts/uploadify-v3.1/uploadify.swf")',
                        'uploader': '/Resource/addimage',
                        @* 'buttonImage': '@Url.Content("~/Scripts/uploadify-v3.1/browse-btn.png")',*@
                        'fileTypeDesc': '图片文件',
                        'method': 'post',
                        'fileTypeExts': '*.gif; *.jpg; *.png;*.gif;*.bmp',
                        'onUploadComplete': function (file) {
                            $('#showimage').html('图片 ' + file.name + ' 成功上传！');
                        }
                        //'onQueueComplete': function (queueData) {
                        //    $('#showimage').html(queueData.uploadsSuccessful + '个图片已经成功上传！.');
                        //}
                    });
                });
            </script>
            <span>上传图片： </span><span><input type="file" id=image1 name="image_upload" style="display:inline-block;" /></span>
            <span>
                <a href="javascript:$('#image1').uploadify('upload','*');">上传</a>
                <a href="javascript:$('#image1').uploadify('cancel', '*');">取消</a>
            </span>
            <div id="showimage"></div>
        </div>

        @if (User.IsInRole("Admin"))
{
    <div class="col-xs-1">
        @Html.Label("审核")
    </div>
    <div class="col-xs-11">
        @Html.RadioButton("checkbtn", 1, true)通过&emsp;
        @Html.RadioButton("checkbtn", 0, false)不通过
    </div>
            <div class="col-xs-11 col-xs-offset-1">
                @Html.ActionLink("上一步", "EditResourceFirstPart", new { resourceid = ViewData["resourceid"] }) <span>&emsp; | &emsp;</span><input type="submit" value="新建" class="button button-raised button-caution button-pill button-normal" />
            </div>
        }
        @Html.Hidden("resourceid", @ViewData["resourceid"])

        @if (User.IsInRole("NomalUser"))
        {
            <input type="submit" value="仅新建" />
            @Html.ActionLink("新建提交审核", "TijiaoShenHe", new { resourceid = ViewData["resourceid"] })
        }
    </fieldset>
    }
</div>

<script>
    $("#carousel-hm").css("display", "none");
    $("#f2 a").html("<font> " + $("#f2 a").text() + " </font>")
    $("#f2 a").addClass("selected");
</script>

